package org.canaan.auth2.service.impl;

import org.canaan.auth2.dao.UserDao;
import org.canaan.auth2.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserServiceImpl implements UserService {
	
	private Logger logger  = LoggerFactory.getLogger(UserServiceImpl.class);
	
	private UserDao userDao;
	
	public UserServiceImpl(){
		logger.debug("init service {}",this.getClass().getName());
	}
	
	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		return userDao.selectByAccount("cheng");
		//return userDao.selectByAccount(username);
	}

	
	public UserDao getUserDao() {
		return userDao;
	}
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
}
